<template>
  <div class="home">
    <dv-loading v-if="loading">Loading...</dv-loading>
    <div v-else class="w100 h100">
      <header>
        <div class="d-flex">
          <dv-decoration-10 class="line" />
          <div class="d-flex center">
            <dv-decoration-8
              :color="['#568aea', '#000000']"
              class="title-deco"
            />
            <div class="title animated swing">
              <span class="title-text ">大数据可视化平台</span>
              <dv-decoration-6
                class="title-bototm"
                :reverse="true"
                :color="['#50e3c2', '#67a1e5']"
              />
            </div>
            <dv-decoration-8
              class="title-deco"
              :reverse="true"
              :color="['#568aea', '#000000']"
            />
          </div>
          <dv-decoration-10 class="line line-rotate" />
        </div>
      </header>
      <div class="content">
        <!-- 左侧 -->
        <div class="content-left-box">
          <!-- 任务通过率 -->
          <div class="chart-box w50 animated bounceInDown">
            <dv-border-box-13 class="chart-box-border">
              <VsLoading :show.sync="showLoading"></VsLoading>
              <VsCenterLeft1 />
            </dv-border-box-13>
          </div>
          <!-- 数据情况 -->
          <div class="chart-box w50 animated bounceInDown">
            <dv-border-box-8 class="chart-box-border">
              <VsLoading :show.sync="showLoading"></VsLoading>
              <VsCenterRight1 />
            </dv-border-box-8>
          </div>
          <!-- 数据统计图 -->
          <div class="chart-box w100 animated bounceInLeft">
            <dv-border-box-12 class="chart-box-border">
              <VsLoading :show.sync="showLoading"></VsLoading>
              <VsLeftCenterBottom />
            </dv-border-box-12>
          </div>
          <!-- 数据雷达图 -->
          <div class="chart-box w100 animated bounceInUp">
            <dv-border-box-13 class="chart-box-border">
              <VsLoading :show.sync="showLoading"></VsLoading>
              <VsLeftBottom />
            </dv-border-box-13>
          </div>
        </div>
        <!-- 右侧 -->
        <div class="content-right-box">
          <!-- 渠道分析 -->
          <div class="chart-box w50 animated bounceInDown">
            <dv-border-box-13 class="chart-box-border">
              <VsLoading :show.sync="showLoading"></VsLoading>
              <VsRightTop1 />
            </dv-border-box-13>
          </div>
          <!-- 排行榜 -->
          <div class="chart-box w50 animated bounceInDown">
            <dv-border-box-8 class="chart-box-border">
              <VsLoading :show.sync="showLoading"></VsLoading>
              <VsRightTop2 />
            </dv-border-box-8>
          </div>
          <!-- 地市排名 -->
          <div class="chart-box w100 animated bounceInRight">
            <dv-border-box-8 class="chart-box-border">
              <VsLoading :show.sync="showLoading"></VsLoading>
              <VsCenterRight />
            </dv-border-box-8>
          </div>
          <!-- TOP5 -->
          <div class="chart-box w100 chart-box w100 animated bounceInUp">
            <dv-border-box-13 class="chart-box-border">
              <VsLoading :show.sync="showLoading"></VsLoading>
              <VsCenterRightTOP5 />
            </dv-border-box-13>
          </div>
        </div>
        <!-- 中间 -->
        <div class="content-center-box">
          <div class="w100 center-statics animated rollIn">
            <dv-border-box-8 class="chart-box-border">
              <VsCenterTop />
            </dv-border-box-8>
          </div>
          <div class="map-box animated rotateInUpLeft">
            <dv-border-box-12 class="chart-box-border">
              <VsLoading :show.sync="showLoading"></VsLoading>
              <VsCenterMap />
            </dv-border-box-12>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters, mapMutations, mapActions } from "vuex";

import VsCenterLeft1 from "./components/leftBox/VsCenterLeft1";
import VsCenterRight1 from "./components/leftBox/VsCenterRight1";
import VsLeftCenterBottom from "./components/leftBox/VsLeftCenterBottom";
import VsLeftBottom from "./components/leftBox/VsLeftBottom";

import VsRightTop1 from "./components/rightBox/VsRightTop1";
import VsRightTop2 from "./components/rightBox/VsRightTop2";
import VsCenterRight from "./components/rightBox/VsCenterRight";
import VsCenterRightTOP5 from "./components/rightBox/VsCenterRightTOP5";

import VsCenterMap from "./components/centerBox/VsCenterMap";
import VsCenterTop from "./components/centerBox/VsCenterTop";

export default {
  computed: {
    ...mapGetters({
      userId: "User/userId",
    }),
  },
  components: {
    VsCenterLeft1,
    VsCenterRight1,
    VsLeftCenterBottom,
    VsLeftBottom,
    VsRightTop1,
    VsRightTop2,
    VsCenterRight,
    VsCenterRightTOP5,
    VsCenterMap,
    VsCenterTop,
  },
  data() {
    return {
      loading: true,
      showLoading: true,
    };
  },
  mounted() {
    this.cancelLoading();
  },
  methods: {
    ...mapMutations({
      setUserId: "User/setUserId",
    }),
    ...mapActions({
      getUserId: "User/getUserId",
    }),
    cancelLoading() {
      setTimeout(() => {
        this.loading = false;
      }, 500);
    },
  },
};
</script>

<style lang="less" scoped>
@boxPadding: 4px;
//flex
.d-flex {
  display: flex;
}
.home {
  width: 100%;
  height: 100%;
  padding: 20px;
  color: #d3d6dd;
  // justify-content: center;
  // display: flex;
  // flex-direction: column;
  // align-items: center;
  header {
    .line {
      width: 33.3%;
      height: 5px;
      &-rotate {
        transform: rotateY(180deg);
      }
    }
    .center {
      flex: 1;
      .title-deco {
        width: 20%;
        height: 40px;
      }
      .title {
        position: relative;
        width: 60%;
        text-align: center;
        background-size: cover;
        background-repeat: no-repeat;
      }
      .title-text {
        font-size: 26px;
        position: absolute;
        width: 100%;
        bottom: 0;
        left: 50%;
        transform: translate(-50%);
      }
      .title-bototm {
        position: absolute;
        bottom: -20px;
        width: 60%;
        height: 10px;
        left: 50%;
        transform: translate(-50%);
      }
    }
  }
  .content {
    height: calc(100% - 60px);
    margin-top: 30px;
    .chart-box {
      height: 33.3%;
      float: left;
      padding: @boxPadding;
      position: relative;
      &-border {
        padding: 20px;
      }
      /deep/.h-title-box {
        display: flex;
        .h-title {
          color: #c3cbde;
        }
        .h-deco {
          width: 100px;
          height: 20px;
          margin-left: 10px;
          margin-top: -4px;
        }
      }
    }
    &-left-box {
      width: 30%;
      height: 100%;
      float: left;
    }
    &-right-box {
      width: 30%;
      height: 100%;
      float: right;
    }
    &-center-box {
      width: 40%;
      height: 100%;
      float: left;
      .center-statics {
        padding: @boxPadding;
        height: 20%;
      }
      .map-box {
        padding: @boxPadding;
        height: 80%;
      }
    }
  }
}
</style>
